/**
 * 2018年11月27日上午11:56:40
 * @author 谢进财
 */
package com.baihang.project.ds.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.baihang.framework.controller.BaseController;
import com.baihang.framework.kit.JsonKit;
import com.baihang.project.ds.service.TextEditorService;

/**
 * @author 文本编辑
 *
 */
@Controller
@RequestMapping("/textEditor")
public class TextEditorController extends BaseController {
		@Autowired
		private TextEditorService service;
		
		@RequestMapping
		public String index() {
			
			
			return "/project/ds/textEditor/index";
		}
		
		@RequestMapping(value ="/getGrid", produces="application/json;charset=UTF-8")
		@ResponseBody
		public String getGrid() {
			String grid = service.getGrid();
			//System.out.println(grid);
			return grid;
		}
		
		@RequestMapping(value ="/ueditorServer", produces="application/json;charset=UTF-8")
		@ResponseBody
		public String ueditorServer() {
			
			return JsonKit.toDoubleJson("true", "ok");
		}
		@RequestMapping(value ="/ueditorSave", produces="application/json;charset=UTF-8")
		@ResponseBody
		public String ueditorSave(String HtmlId,String HtmlName,String HtmlContent,String HtmlRemark) {
			String result="true";
			String msg="保存成功";
			if(!service.ueditorSave(Integer.valueOf(HtmlId), HtmlName, HtmlContent, HtmlRemark)) {
				result="false";
				msg="保存失败";
			}
			return JsonKit.toDoubleJson(result, msg);
		}
}
